@extends('admin.inc.base')
@section('content')

    <div class="panel panel-default">
        <div class="panel-heading">
            编辑菜单
        </div>
        <div class="panel-body">
            <form action="/admin/menu/{{ $menu->id }}" method="post">
                <div class="form-group">
                    <label for="">名称</label>
                    <input type="text" class="form-control" name="title"  value="{{ $menu->title }}" placeholder="名称">
                </div>

                <div class="form-group">
                    <label for="">英文名称</label>
                    <input type="text" class="form-control" name="entitle" value="{{ $menu->entitle }}"  placeholder="英文名称名称">
                    <div class="help-block">根据模板需要填写</div>
                </div>

                <div class="form-group">
                    <label for="">连接地址</label>
                    <input type="text" class="form-control" name="url"  value="{{ $menu->url }}" placeholder="连接地址">
                </div>

                <div class="form-group">
                    <label for="">打开方式</label>
                    <select name="target" class="form-control">
                        <option value="_self" @if($menu->target == '_self') selected @endif>当前窗口</option>
                        <option value="_blank" @if($menu->target == '_blank') selected @endif>新窗口</option>
                    </select>
                </div>

                <div class="form-group">
                    <label for="">父菜单</label>
                    <select name="pid" class="form-control">
                        <option value="0">顶级菜单</option>
                        @foreach( $menus as $key => $val )
                            @if($val['pid'] == 0)
                                <option value="{{ $val['id'] }}" @if($menu->pid == $val['id']) selected @endif>{{ $val['title'] }}</option>
                                @if(!empty($val['sub']))
                                    @foreach($val['sub'] as $sk => $sv)
                                        <option value="{{ $sv['id'] }}" @if($menu->pid == $sv['id']) selected @endif>----{{ $sv['title'] }}</option>
                                    @endforeach
                                @endif
                            @endif
                        @endforeach
                    </select>

                    <p class="help-block"></p>
                </div>


                <div class="form-group">
                    <label for="">菜单类型</label>
                    <select name="position" class="form-control">
                        <option value="1" @if($menu->position == 1) selected @endif>顶部菜单</option>
                        <option value="2" @if($menu->position == 2) selected @endif>底部菜单</option>
                    </select>
                </div>


                <button type="submit" class="btn btn-default">提交</button>
            </form>
        </div>
    </div>

@endsection